package com.xing.okhttp;

import com.google.common.collect.ImmutableMap;
import org.json.simple.JSONObject;
import org.json.simple.JSONStreamAware;

import java.io.IOException;
import java.io.Writer;
import java.util.Map;

public class Model implements JSONStreamAware {
    public int id = 1;
    public String name = "test";
    public String desc = "()V";
    public String content = "hello world !";



    @Override
    public void writeJSONString(Writer pWriter) throws IOException {
        Map<Object, Object> toSend = ImmutableMap.builder()
                .put("id", id)
                .put("name", name)
                .put("desc", desc)
                .put("content", content)
                .build();

        JSONObject.writeJSONString(toSend, pWriter);
    }
}
